/**
 * 
 */
package com.jie.eclipse.pan.swtitem.widgets;

import org.eclipse.swt.widgets.Composite;

import com.jie.eclipse.pan.bind.BaseDataBind;
import com.jie.eclipse.pan.bind.PageDataBind;
import com.jie.eclipse.pan.data.BaseDataEntity;
import com.jie.eclipse.pan.xml.XMLNode;

/**
 * @author yanjie
 *
 */
public class BaseComposite{
	private BaseDataBind dataBind = null;//数据绑定
	private Composite cps = null;
	private String nodeName = "";
	private XMLNode node = null;

	private BaseDataEntity data = null;
	/**
	 * @param parent
	 * @param style
	 */
	public BaseComposite(XMLNode node,Composite cps) {
		this(node, cps, null);
	}
	
	/**
	 * @param parent
	 * @param style
	 */
	public BaseComposite(XMLNode node,Composite cps,BaseDataEntity data) {
		this.node = node;
		if(this.node != null)
			this.nodeName = this.node.getNodeName();
		
		this.cps = cps;
		this.dataBind = new BaseDataBind();
		this.data = data;
	}
	
	public BaseDataBind getDataBind() {
		return dataBind;
	}
	
	public BaseDataBind getNewDataBind() {
		return new PageDataBind();
	}

	public void setDataBind(BaseDataBind dataBind) {
		this.dataBind = dataBind;
	}
	
	public String getNodeName() {
		return nodeName;
	}
	
	public Composite getComposite() {
		return cps;
	}
	
	public BaseDataEntity getDataInstance(){
		if(this.data == null){
			this.data = new BaseDataEntity();
		}
		return this.data;
	}
	
	public XMLNode getNode() {
		return node;
	}
	
	public void setNode(XMLNode node) {
		this.node = node;
	}
}
